<extend name="Public/base" />
<block name="style">
    <style type="text/css">
        .form-item{border-bottom: 1px dashed #ccc;padding-top: 5px;padding-bottom: 5px;}
        .item-label{float: left;width: 130px;text-align: right;padding-right: 20px;color: #999;}
        .controls{float: left;}
    </style>
</block>
<block name="body"><php>    $PROVINCE = C('PROVINCE');</php>
    <div class="main-title cf">
        <h2 style="padding-left: 10px;">{$info.realname} 详细资料</h2>
    </div>
    <!-- 标签页导航 -->
    <div class="tab-wrap">
        <div class="tab-content">
            <ul class="tab-nav nav">
                <li data-tab="tab1" class="current"><a href="javascript:void(0);">个人信息 </a></li>
                <li data-tab="tab2" class=""><a href="javascript:void(0);">职业信息 </a></li>
                <li data-tab="tab3" class=""><a href="javascript:void(0);">社会关系 </a></li>
            </ul>
            <!-- 表单 -->
            <form id="form" method="post" class="form-horizontal doc-modal-form">
                       <!-- 学籍信息  -->
                <div id="tab1" class="tab-pane in tab1">
                  <input type="hidden" name="uid" value="{$info['uid']}">


                            <div class="form-item cf">
                              <label class="item-label">婚姻状态</label>
                              <div class="controls">
                                <php>
                                    $MEMBER_MARITAL_STATUS =   C('MEMBER_MARITAL_STATUS');

                                </php>

                                <select class="" name="member[marital_status]">
                                    <foreach name="MEMBER_MARITAL_STATUS" item="val" key="key">
                                        <option <eq name="key" value="$info['marital_status']">selected="selected"</eq> value="{$key}">{$val}</option>
                                    </foreach>
                                </select>
                              </div>
                            </div>
      
                            <div class="form-item cf">
                              <label class="item-label">居住省份</label>
                              <div class="controls">
                                <php>
                                    $PROVINCE =   C('PROVINCE');

                                </php>

                                <select class="" name="member[reside_province]" id="province">
                                    <foreach name="PROVINCE" item="val" key="key" >
                                        <option <eq name="key" value="$info['reside_province']">selected="selected"</eq> value="{$key}">{$val}</option>
                                    </foreach>
                                </select>
                              </div>
                            </div>




                            <!-- <div class="form-item cf">
                              <label class="item-label">居住区域</label>
                              <div class="controls">



                                <select class="" name="member[reside_area]">
                                    <foreach name="Area" item="val" key="key">
                                        <option <eq name="key" value="$info['reside_area']">selected="selected"</eq> value="{$key}">{$val.name}</option>
                                    </foreach>
                                </select>


                              </div>
                            </div>
 -->

<!-- 
                            <div class="weui-cell reside_area_select">
                                <div class="weui-cell__hd"><label class="weui-label">居住区域：</label></div>
                                <div class="weui-cell__bd">
                                    <div class="weui-cell weui-cell_select">
                                        <input type="hidden" value="{$info.reside_area}" class="reside_area" name="member[reside_area]" >
                                        <div class="weui-cell__bd reside_area_text">
                                            <empty name="info['reside_area']">
                                                请选择
                                                <else/>
                                                <php>
                                                    $data   =   D('Area')->get_addr($info['reside_area']);echo ($data);
                                                </php>
                                            </empty>
                                        </div>
                                    </div>
                                </div>
                            </div> -->





                    <div class="form-item cf">
                        <label class="item-label">居住区域</label>
                        <div class="controls" id="area">
                          <span>
                          <php>
                                $data   =   D('Area')->get_addr($info['reside_area']);
                                print_r($data);
                               
                            </php>
                            </span>
                        </div>
                    </div>





                    <div class="form-item cf">
                        <label class="item-label">详细地址：  </label>
                        <div class="controls">
                          <input type="text" name="reside_addr"  value="{$info.reside_addr}" style="border:none;background:#F6F6F6">
                            <!-- <span>{$info.reside_addr}</span> -->
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label">居住时长</label>
                        <div class="controls">
                          <php>
                              $MEMBER_RESIDE_DURATION =   C('MEMBER_RESIDE_DURATION');

                          </php>

                          <select class="" name="member[reside_duration]" >
                              <foreach name="MEMBER_RESIDE_DURATION" item="val" key="key" >
                                  <option <eq name="key" value="$info['reside_duration']">selected="selected"</eq> value="{$key}">{$val}</option>
                              </foreach>
                          </select>
                        </div>
                      </div>

                </div>

                    <!-- 学历信息  -->
                       <div id="tab2" class="tab-pane tab2">

                           <div class="form-item cf">
                               <label class="item-label">单位名称：</label>
                               <div class="controls">
                                <input type="text" name="unitname"  value="{$info.unitname}" style="border:none;background:#F6F6F6">
                                   <!-- <span>{$info.unitname}</span> -->
                               </div>
                           </div>


                           <div class="form-item cf">
                              <label class="item-label">职业类型</label>
                              <div class="controls">
                                <php>
                                    $MEMBER_CAREER_TYPE =   C('MEMBER_CAREER_TYPE');

                                </php>

                                <select class="" name="member[career_type]" >
                                    <foreach name="MEMBER_CAREER_TYPE" item="val" key="key" >
                                        <option <eq name="key" value="$info['career_type']">selected="selected"</eq> value="{$key}">{$val}</option>
                                    </foreach>
                                </select>
                              </div>
                            </div>
                              <div class="form-item cf">
                                <label class="item-label">单位省份</label>
                                <div class="controls">
                                  <php>
                                      $PROVINCE =   C('PROVINCE');

                                  </php>

                                  <select class="" name="member[unit_province]" id="unit_province">
                                      <foreach name="PROVINCE" item="val" key="key" >
                                          <option <eq name="key" value="$info['unit_province']">selected="selected"</eq> value="{$key}">{$val}</option>
                                      </foreach>
                                  </select>
                                </div>
                              </div>


                           <div class="form-item cf">
                               <label class="item-label">单位城市 ：  </label>
                               <div class="controls" id="unit_area">
                                   <span><php>
                                       $data   =   D('Area')->get_addr($info['unit_area']);echo ($data);
                                   </php></span>
                               </div>
                           </div>







                           <div class="form-item cf">
                               <label class="item-label">单位地址 ：  </label>
                               <div class="controls">
                                <input type="text" name="unit_addr"  value="{$info.unit_addr}" style="border:none;background:#F6F6F6">

                                   <!-- <span>{$info.unit_addr}</span> -->
                               </div>
                           </div>
                           <div class="form-item cf">
                               <label class="item-label">单位电话 ：  </label>
                               <div class="controls">
                                <input type="text" name="unit_phone"  value="{$info.unit_phone}" style="border:none;background:#F6F6F6">

                                   <!-- <span>{$info.unit_phone}</span> -->
                               </div>
                           </div>


                       </div>
                    <div id="tab3" class="tab-pane tab3">
                      <div class="form-item cf">
                              <label class="item-label">亲属关系</label>
                              <div class="controls">
                                <php>
                                    $MEMBER_RELATI_ONSHIP =   C('MEMBER_RELATI_ONSHIP');

                                </php>

                               <select class="weui-select relati_onship" name="member[relati_onship]">
                                    <foreach name="MEMBER_RELATI_ONSHIP" key="key" item="val">
                                        <option class="option{$key}"  <eq name="key" value="$info['child_status']">selected="selected"</eq> value="{$key}">{$val}</option>
                                    </foreach>
                                </select>
                              </div>
                            </div>
                        <div class="form-item cf">
                            <label class="item-label">姓名：</label>
                            <div class="controls">
                                <input type="text" name="relati_name"  value="{$info.relati_name}" style="border:none;background:#F6F6F6">

                                <!-- <span>{$info.relati_name}</span> -->
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">号码：</label>
                            <div class="controls">
                                <input type="text" name="relati_number"  value="{$info.relati_number}" style="border:none;background:#F6F6F6">

                                <!-- <span>{$info.relati_number}</span> -->
                            </div>
                        </div>

                        <div class="form-item cf">
                              <label class="item-label">亲属关系</label>
                              <div class="controls">
                                <php>
                                    $MEMBER_SOCIAL_RELATIONS =   C('MEMBER_SOCIAL_RELATIONS');

                                </php>

                                <select class="" name="member[social_relations]" >
                                    <foreach name="MEMBER_SOCIAL_RELATIONS" item="val" key="key" >
                                        <option <eq name="key" value="$info['social_relations']">selected="selected"</eq> value="{$key}">{$val}</option>
                                    </foreach>
                                </select>
                              </div>
                            </div>
                        <div class="form-item cf">
                            <label class="item-label">姓名：</label>
                            <div class="controls">
                                <input type="text" name="social_name"  value="{$info.social_name}" style="border:none;background:#F6F6F6">

                                <!-- <span>{$info.social_name}</span> -->
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">>号码：</label>
                            <div class="controls">
                                <input type="text" name="social_number"  value="{$info.social_number}" style="border:none;background:#F6F6F6">

                                <!-- <span>{$info.social_number}</span> -->
                            </div>
                        </div>
                    </div>
            </form>
        </div>

        <button class="btn" > 确认修改</button>

    </div>
</block>
<block name="script">
    <script type="text/javascript" src="__STATIC__/jquery.dragsort-0.5.1.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        Think.setValue("extend", {$info.extend|default=0});
        //导航高亮
        highlight_subnav('{:U('User/index')}');



        $(function(){
            showTab();
        })
        // 获取省份编码
        $('#province').change(function(){
          var num=$('#province :selected').val();
          
          $.ajax({
            type:'post',
            data:{'num':num},
            dataType:'json',
            url:"{:U('get_area')}",
            success:function(m){
             // alert(m.length)
             var str='';
             str+='<select class="" name="member[reside_area]">';
              for (var i = 0; i < m.length; i++) {
                // alert(m[i].name)
                str+='<option  value="'+m[i].id+'">'+m[i].name+'</option>';
                
                
              }
              str+='</select>';
              $('#area').html(str);
              $('#area').unbind('click');
            }
          })

        })


        $('#area').click(function(){
              var num=$('#province :selected').val();
              
              $.ajax({
                type:'post',
                data:{'num':num},
                dataType:'json',
                url:"{:U('get_area')}",
                success:function(m){
                 // alert(m.length)
                 var str='';
                 str+='<select class="" name="member[reside_area]">';
                  for (var i = 0; i < m.length; i++) {
                    // alert(m[i].name)
                    str+='<option  value="'+m[i].id+'">'+m[i].name+'</option>';
                    
                    
                  }
                  str+='</select>';
                  $('#area').html(str);
                  $('#area').unbind('click');
                  // $('.area').find('#area').html(str);
                }
              })

        })

        // 根据省份  需要匹配对应城市

       $('#reside_province').change(function(){
          var num=$('#reside_province :selected').val();
          
          $.ajax({
            type:'post',
            data:{'num':num},
            dataType:'json',
            url:"{:U('get_area')}",
            success:function(m){
             // alert(m.length)
             var str='';
             str+='<select class="" name="member[unit_area]">';
              for (var i = 0; i < m.length; i++) {
                // alert(m[i].name)
                str+='<option  value="'+m[i].id+'">'+m[i].name+'</option>';
                
                
              }
              str+='</select>';
              $('#unit_area').html(str);
              $('#unit_area').unbind('click');
            }
          })

        })


        $('#unit_area').click(function(){
              var num=$('#reside_province :selected').val();
              
              $.ajax({
                type:'post',
                data:{'num':num},
                dataType:'json',
                url:"{:U('get_area')}",
                success:function(m){
                 // alert(m.length)
                 var str='';
                 str+='<select class="" name="member[unit_area]">';
                  for (var i = 0; i < m.length; i++) {
                    // alert(m[i].name)
                    str+='<option  value="'+m[i].id+'">'+m[i].name+'</option>';
                    
                    
                  }
                  str+='</select>';
                  $('#unit_area').html(str);
                  $('#unit_area').unbind('click');
                  // $('.area').find('#area').html(str);
                }
              })

        })


        $('.btn').click(function(){
          var data=$('form').serializeArray();
          $.ajax({
            type:'post',
            data:data,
            url:"{:U('update')}",
            success:function(m){
              alert(m)
              location.reload();
            }
          })
        })


    </script>



</block>

